package org.teamh.gui.ingame.effects;

import org.teamh.gui.GUI;
import org.teamh.gui.ingame.data_structure.SafeList.Element;
import org.teamh.logic.datamodel.Tower;

public class ShotManager {

	private GUI gui;
	
	public ShotManager(GUI gui) {
		this.gui = gui;
	}
	
	public void update() {
		Element<Tower> next = gui.getStart().getLogic().getManager().getTowers().getHead();
		Tower t;
		while(next != null) {
			t = next.getE();
			
			if(t.getUserAssets() != null && t.getFiresOn() != null && t.canFire()) {
				t.setLastShot(System.currentTimeMillis());
				EffectManager.get().addEffectFiredOn(t.getID(), t.getFiresOn().getID());
			}
			
			next = next.getNext();
		}
	}
}
